package top.chendawei.util;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class JsonResult<T> {
    private boolean success;
    private String message;
    private Integer total;
    private List<T> records;
    private Integer current;
    private Integer pageSize;
    private Integer totalPage;
    private Map<String, Object> attribute;

    public JsonResult() {
        this.total = 0;
        this.records = new ArrayList();
        this.attribute = new HashMap();
        this.success = true;
    }

    public void addAttribute(String key, Object value) {
        this.attribute.put(key, value);
    }

    public void removeAttribute(String key) {
        this.attribute.remove(key);
    }
}
